From: Andrew Cooper Date: Tue, 4 Feb 2020 20:29:38 +0000 (+0000) Subject: libxc/restore: Fix REC_TYPE_X86_PV_VCPU_XSAVE data auditing (take 2) X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~753 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=0729830cc425a8ff27a3137e87b93768ae3c853c;p=xen.git libxc/restore: Fix REC_TYPE_X86_PV_VCPU_XSAVE data auditing (take 2) It turns out that a bug (since forever) in Xen causes XSAVE records to have non-architectural behaviour on xsave-capable hardware, when a PV guest has not touched the state. In such a case, the data record returned from Xen is 2*uint64_t, both claiming the (illegitimate) state of %xcr0 and %xcr0_accum being 0. Adjust the bound in handle_x86_pv_vcpu_blob() to cope with this. Fixes: 2a62c22715b "libxc/restore: Fix data auditing in handle_x86_pv_vcpu_blob()" Reported-by: Igor Druzhinin Signed-off-by: Andrew Cooper Acked-by: Wei Liu --- diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xc_sr_restore_x86_pv.c index 16e738884e..904ccc462a 100644 --- a/tools/libxc/xc_sr_restore_x86_pv.c +++ b/tools/libxc/xc_sr_restore_x86_pv.c @@ -827,10 +827,10 @@ static int handle_x86_pv_vcpu_blob(struct xc_sr_context *ctx, break; case REC_TYPE_X86_PV_VCPU_XSAVE: - if ( blobsz < 128 ) + if ( blobsz < 16 ) { ERROR("%s record too short: min %zu, got %u", - rec_name, sizeof(*vhdr) + 128, rec->length); + rec_name, sizeof(*vhdr) + 16, rec->length); goto out; } blob = &vcpu->xsave;